package com.example.web.listener;


import com.example.web.event.PriceEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class PriceEventListener {


    @EventListener
    public void pushPriceToDevices(PriceEvent priceEvent) {
        log.info("通知准备推送价格到设备价签上");
    }

    @EventListener
    public void refreshCacheInfo(PriceEvent priceEvent) {
        log.info("刷新缓存");
    }

    @EventListener
    public void doLog(PriceEvent priceEvent) {
        log.info("变化价格:{}",priceEvent.getOriginal().subtract(priceEvent.getCurrent()));
    }

}
